home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "ProgressBAR"
- Sub Progress(OBJ As PictureBox, ByVal Current As Integer, _
- max As Integer, Optional Caption As String)
-
- '*************************************************************
- 'Draws progress bar in a picture box
- Dim Percent As String
- Dim Tmp As Long
- '*************************************************************
-
- If Not OBJ.AutoRedraw Then
- OBJ.AutoRedraw = -1
- End If
- OBJ.Cls
-
- Tmp = Current / max * 100
- If Caption = "" Then
- Percent = Format(Str(Tmp), "!@@@") + "%"
- ElseIf Left(Caption, 1) = "%" Then
- Percent = Mid(Caption, 2, Len(Caption) - 2) + " " + Format(Str(Tmp), "!@@@") + "%"
- Else
- Percent = Caption
- End If
-
- If Tmp = 0 Then
- OBJ.ScaleWidth = max
- OBJ.DrawMode = 10
- OBJ.Font.Bold = True
- OBJ.ForeColor = RGB(0, 0, 255)
- End If
-
- 'Centre Text in picture box
- OBJ.CurrentX = OBJ.ScaleWidth / 2 - OBJ.TextWidth(Percent) / 2
- OBJ.CurrentY = (OBJ.ScaleHeight - OBJ.TextHeight(Current)) / 2
- OBJ.Print Percent
-
- OBJ.Line (0, 0)-(Current, OBJ.ScaleWidth), , BF
- OBJ.Refresh
- DoEvents
-
- If Tmp = 100 Then OBJ.Cls
- End Sub
-